import 'package:asperm/tools/const.dart';
import 'package:asperm/views/custom_cell.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../views/myDialog.dart';


class StartTestingPage extends StatefulWidget {
  const StartTestingPage({super.key});

  @override
  State<StartTestingPage> createState() => _StartTestingPageState();
}

class _StartTestingPageState extends State<StartTestingPage> {

  List contentList = [];
  List imageList = [];

  @override
  void initState() {
    super.initState();

    contentList =[
      'Abstain from sex for 2 to 7 days',
      'Don’t close the app for now! If you interrupt it, you’ll have to start over!',
      'Please test at 10°C-30°C',
      '1 DEVICE and CABLE',
      '1 Collection Cup',
      '1 Testing Slide',
      '1 Sampling pipe',
      '1 Plastic Pipette',

    ];

    print('--------------initState');

  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Color(0xffF9F9F9),
        appBar: AppBar(
          centerTitle: false,
        ),
        body: Container(
          height: screenHeight(context),
          child: Container(
            width: double.infinity,
            color: Color(0xffF9F9F9),
            child: contentWidget(context),
          ),
        )
    );
  }

  contentWidget(BuildContext context) {
    return Scrollbar(
        thickness: 6,
        radius: const Radius.circular(3),
        interactive: true,
        child: SingleChildScrollView(

          child: Column(
            children: [
              Container(
                margin: EdgeInsets.only(left: 20.w,right: 20.w,bottom: 20.w),
                child:Text(
                  'Here\'s what we need to do before the test',
                  style: TextStyle(
                    color: Colors.black,
                    fontSize: 20.sp,
                    fontWeight: FontWeight.w600,
                    letterSpacing: 0,
                    height: 1.2,
                  ),
                ),
              ),
              Container(
                margin: EdgeInsets.only(left: 20.w,right: 20.w,top: 20.w),
                child:  ListView.builder(
                  shrinkWrap: true,
                  itemBuilder: (BuildContext context, int index) {
                    return itemWidgetList(context,index);
                  },
                  itemCount: contentList.length,
                ),
              ),
              Container(
                height: 48.h,
                width: 335.w,
                decoration: BoxDecoration(
                  color: Color.fromRGBO(16, 37, 105, 1),
                  borderRadius: BorderRadius.circular(5.h),
                ),
                margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 60.h),
                child: TextButton(
                  onPressed: () {
                    Navigator.pushNamed(context, '/testing_steps_page');
                  },
                  child: Text(
                    'CONFIRM',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 16.sp,
                      fontWeight: FontWeight.w400,

                    ),
                  ),
                ),
              ),

            ],
          ),
        )
    );
  }




  itemWidgetList(BuildContext context, int index) {
    return Container(
      child: CustomCell(
        title: contentList[index],
        isHideArrows: true,
        imageName: '',
        clickAction: (){
          Navigator.pushNamed(context, '/tips_page');

        },
      ),
    );
  }
}

